﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZX.SYS.Library;
using ZX.DBModule;
using System.Data;

namespace ZX.SYS.Bussiness.Message
{
    public partial class BDatMessagePool : BLL.Extend.BaseBussnies<DatMessagePool>
    {
        public BDatMessagePool() { this.entity = new DatMessagePool(); }

        /// <summary>
        /// 设置消息为已发送
        /// </summary>
        /// <param name="messageId">消息Id</param>
        /// <returns>影响记录条数</returns>
        public int setSendState(Guid MPoolID)
        {

            try
            {
                string sql = "exec  sp_Dat_setMessagePoolSendState '" + MPoolID.ToString() + "'";
                return this.RunSqlCommand(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 设置消息为已发送
        /// </summary>
        /// <param name="QueryID">关联ID</param>
        /// <param name="ReceiverID">接收人ID</param>
        /// <returns></returns>
        public int setSendState(Guid QueryID, Guid ReceiverID)
        {
            int i = 0;
            try
            {
                string sql = "exec sp_Dat_setMessageSendState '" + QueryID.ToString() + "','" + ReceiverID.ToString() + "'";
                i= this.RunSqlCommand(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return i;
        }
        public void AddMessage(Guid MsgID,Guid ReceiverID) 
        {
            DatMessagePool mp = new DatMessagePool();
            mp.MsgID = MsgID;
            mp.ReceiverID = ReceiverID;
            mp.Save();
        }




    }
}
